export function localGet (key) {
  const value = window.localStorage.getItem(key)
  try {
    return JSON.parse(window.localStorage.getItem(key))
  } catch (error) {
    return value
  }
}

export function localSet (key, value) {
  window.localStorage.setItem(key, JSON.stringify(value))
}

export function localRemove (key) {
  window.localStorage.removeItem(key)
}

// 判断内容是否含有表情字符，现有数据库不支持。
export function hasEmoji (str = '') {
  const reg = /[^\u0020-\u007E\u00A0-\u00BE\u2E80-\uA4CF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF\u0080-\u009F\u2000-\u201f\u2026\u2022\u20ac\r\n]/g;
  return str.match(reg) && str.match(reg).length
}

// 单张图片上传
export const uploadImgServer = 'http://localhost:8080/common/upload/file'

export const ossPath = 'https://endwork-zxy.oss-cn-hangzhou.aliyuncs.com/'
// 多张图片上传
export const uploadImgsServer = 'http://localhost:8080/common/upload/files'

export const pathMap = {
  login: '登录',
  sysMain: '主页',
  sysManage: '系统管理',
  sysUser: '用户管理',
  sysRole: '角色管理',
  sysPermission: '菜单管理',
  // 药品分类管理
  drugCategoryManagement: '药品分类管理',
  //供应商管理
  supplierManagement: '供应商管理',
  pharmacyManagement: '药店管理',
  employeeManagement: '员工管理',
  layoutManagement: '排版管理',
  drugManagement: '药品管理',
  orderManagement: '订单管理'
}
